<?
ob_start(); 
include("common/header.html");
include('common/autoload.php');
$out_html=ob_get_contents();
ob_end_clean();
include_once("class/ProOrder_dt.php");
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
// 分销商获取供应商
if($_SESSION['dtype']==0 || $_SESSION['dtype']==1) {
	include 'getDistors.php';
    $DistorsNames = getDistors($GLOBALS['le']);
	$dTypeName = '供应商';
}

// 异步获取对应的景点门票
if($_SERVER['HTTP_REQUEST_TYPE']=='getTicket'){
	$sql='SELECT id,title FROM uu_jq_ticket WHERE landid='.($_REQUEST['landid']+0);//
	$GLOBALS['le']->query($sql);
	$tickes = array();
	while($row=$GLOBALS['le']->fetch_assoc()){
		$tickes[]=$row;
	}
	if(count($tickes)){
		echo json_encode(array('s'=>'success','content'=>$tickes));
	}else{
		echo json_encode(array('s'=>'fail'));
	}
	exit;
}

$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
$memberID=$_SESSION['sid'];
$object=buyProOrderObject($memberID,$s,$_SESSION['sdtype']);
//交易时间类型
$timeType = isset($_REQUEST['time_type'])? abs($_REQUEST['time_type']) : 1;
$btime=$_REQUEST['begintime']?$_REQUEST['begintime']:date("Y-m-01");
$etime=$_REQUEST['endtime']?$_REQUEST['endtime']:date("Y-m-d");
$by=$_REQUEST['by']?$_REQUEST['by']:"lid";
$option=array();
if(count($_REQUEST['status'])>0){
	$option['status']=implode("|",$_REQUEST['status']);
}
if($_REQUEST['fid']){
	$option['mid']=$_REQUEST['fid'];
}
//$r=$object->orderSum($btime." 00:00:00",$etime." 23:59:59",$by,$option);
$r=$object->_orderSum($btime." 00:00:00",$etime." 23:59:59",$by,$option,$timeType);
$titleT=array("lid"=>"景区名称","tid"=>"票类名称","mid"=>"分销商名称");
$totals=array();
/*导出EXCEL处理程序--begin-*/
include("ExcelHandle.php");
/*导出EXCEL处理程序--end*/
echo $out_html;
$hTitle="购买报表";




// 获取产品
$sql='SELECT id,title FROM uu_land WHERE apply_did='.$_SESSION['memberID'];//
$GLOBALS['le']->query($sql);
$products = array();
while($row=$GLOBALS['le']->fetch_assoc()){
	$products[]=$row;
}

include("tpl/orderReport.tpl.bk");
include("common/footer.html");
?>